package com.xx.bysj.controller;

import com.xx.bysj.aop.LogAop;
import com.xx.bysj.aop.LogConsts;
import com.xx.bysj.dto.HnOrder;
import com.xx.bysj.service.AssignService;
import com.xx.bysj.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/assign")
public class AssignController {

    @Autowired
    AssignService assignService;

    @RequestMapping("/query")
    @ResponseBody
    @LogAop(actionName = "新增订单",actionType = LogConsts.ACTION_ADD)
    public Result query(HnOrder order, Authentication authentication,
                        @RequestParam int page,
                        @RequestParam int limit){
        return assignService.query(order,authentication,page,limit);
    }

    @RequestMapping("/update")
    @ResponseBody
    @LogAop(actionName = "新增订单",actionType = LogConsts.ACTION_ADD)
    public Result update(Authentication authentication,
                        @RequestParam("ids") List<Integer> ids,
                        @RequestParam("userId") Integer userId){
        return assignService.update(authentication,ids,userId);
    }

}
